<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>02-键盘事件对象</title>
</head>
<body>
    <input type="text" name="" id="">
    <script>
        /* 
            ascill码：每一个按键，都有一个数值对应
            keypress:不能触发功能键（delete 上下左右等）
            只有keypress 可以区分大小写
        */
       let str = 'abc';
       console.log(str.charCodeAt(0));
       document.addEventListener('keyup',function(e){
           console.log('------keyup------');
           console.log('e.key:---' + e.key + 'e.keyCode---'+e.keyCode);
       });

       document.addEventListener('keydown',function(e){
           console.log('------keydown------');
           console.log('e.key:---' + e.key + 'e.keyCode---' + e.keyCode);
       });

       document.addEventListener('keypress',function(e){
           console.log('-------keypress------');
           console.log('e.key:---' + e.key + 'e.keyCode:---'+e.keyCode);
       });
    </script>
</body>
</html>